package com.ruoyi.food.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.food.mapper.WarehouseEntryMapper;
import com.ruoyi.food.domain.WarehouseEntry;
import com.ruoyi.food.service.IWarehouseEntryService;

/**
 * 粮食入库Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-13
 */
@Service
public class WarehouseEntryServiceImpl implements IWarehouseEntryService 
{
    @Autowired
    private WarehouseEntryMapper warehouseEntryMapper;

    /**
     * 查询粮食入库
     * 
     * @param id 粮食入库主键
     * @return 粮食入库
     */
    @Override
    public WarehouseEntry selectWarehouseEntryById(Long id)
    {
        return warehouseEntryMapper.selectWarehouseEntryById(id);
    }

    /**
     * 查询粮食入库列表
     * 
     * @param warehouseEntry 粮食入库
     * @return 粮食入库
     */
    @Override
    public List<WarehouseEntry> selectWarehouseEntryList(WarehouseEntry warehouseEntry)
    {
        return warehouseEntryMapper.selectWarehouseEntryList(warehouseEntry);
    }

    /**
     * 新增粮食入库
     * 
     * @param warehouseEntry 粮食入库
     * @return 结果
     */
    @Override
    public int insertWarehouseEntry(WarehouseEntry warehouseEntry)
    {
        warehouseEntry.setCreateTime(DateUtils.getNowDate());
        return warehouseEntryMapper.insertWarehouseEntry(warehouseEntry);
    }

    /**
     * 修改粮食入库
     * 
     * @param warehouseEntry 粮食入库
     * @return 结果
     */
    @Override
    public int updateWarehouseEntry(WarehouseEntry warehouseEntry)
    {
        warehouseEntry.setUpdateTime(DateUtils.getNowDate());
        return warehouseEntryMapper.updateWarehouseEntry(warehouseEntry);
    }

    /**
     * 批量删除粮食入库
     * 
     * @param ids 需要删除的粮食入库主键
     * @return 结果
     */
    @Override
    public int deleteWarehouseEntryByIds(Long[] ids)
    {
        return warehouseEntryMapper.deleteWarehouseEntryByIds(ids);
    }

    /**
     * 删除粮食入库信息
     * 
     * @param id 粮食入库主键
     * @return 结果
     */
    @Override
    public int deleteWarehouseEntryById(Long id)
    {
        return warehouseEntryMapper.deleteWarehouseEntryById(id);
    }
}
